import { defHttp,jsonHttp } from '@/utils/http/axios';
import {
  chatidParams,
  deptListParams,
  deptUserListParams,
  integralListParams,
  rankingListParams,
} from './model/deptModel';
import { BasicListResult, BasicDataResult } from '../model/baseModel';

import { ErrorMessageMode } from '#/axios';

enum Api {
  //Login = '/login',
  productList = '/jz/wm/product/productList',
  saveProduct = '/jz/wm/product/saveProduct',
  productDelete = '/jz/wm/product/productDelete',
  productStock = '/jz/wm/product/productStock',
  productUp = '/jz/wm/product/productUp',
  productDown = '/jz/wm/product/productDown',
  productDownQuery = '/jz/wm/product/productDownQuery',
  productSpecList = '/jz/wm/product/productSpecList',
  saveProductSpec = '/jz/wm/product/saveProductSpec',
  productSpecDelete = '/jz/wm/product/productSpecDelete',
  productDetail = '/jz/wm/product/productDetail',
  saveSku = '/jz/wm/product/saveSku',
  getNo= '/jz/wm/product/getNo',
  supplierList= '/jz/wm/product/supplierList',
  supplierSave= '/jz/wm/product/supplierSave',
  supplierDelete= '/jz/wm/product/supplierDelete',
  supplierAllList= '/jz/wm/product/supplierAllList',

}

/**
 * @description: user login api
 */
export function productListApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function saveProductApi(params: any, mode: ErrorMessageMode = 'modal') {
  return jsonHttp.post<BasicDataResult>(
    {
      url: Api.saveProduct,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function productDeleteApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function productStockApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productStock,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}


//上架
export function productUpApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productUp,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function productDownApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productDown,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function productDownQueryApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productDownQuery,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function productSpecListApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productSpecList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function saveProductSpecApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.saveProductSpec,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * 产品规格删除
 * @param params
 * @param mode
 */
export function productSpecDeleteApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productSpecDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * 产品详情
 * 包含sku信息
 * @param params
 * @param mode
 */
export function productDetailApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.productDetail,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

/**
 * 保存sku
 * @param params
 * @param mode
 */
export function saveSkuApi(params: any, mode: ErrorMessageMode = 'modal') {
  return jsonHttp.post<BasicDataResult>(
    {
      url: Api.saveSku,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function getNoApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.getNo,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}


export function supplierListApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.supplierList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function supplierSaveApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.supplierSave,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function supplierDeleteApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.supplierDelete,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function supplierAllListApi(params: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<BasicDataResult>(
    {
      url: Api.supplierAllList,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
